#ifndef SDK_OHOS_API_OHOS_RTP_TRANSCIVER_INTERFACE_H_
#define SDK_OHOS_API_OHOS_RTP_TRANSCIVER_INTERFACE_H_

#include "api/ref_count.h"
#include "api/scoped_refptr.h"
#include "api/media_types.h"
#include "api/rtp_parameters.h"
#include "api/rtp_transceiver_direction.h"
#include "api/rtc_error.h"
#include "api/rtp_transceiver_interface.h"
#include "ohos_rtp_receiver_interface.h"
#include "ohos_rtp_sender_interface.h"

namespace ohoswebrtc {

class OHOSMediaTrackInterface;
class OHOSMediaStreamInterface;

class OHOSRtpTransceiverInterface : public webrtc::RefCountInterface {
  public:

    /** Media type of the transceiver. The sender and receiver will also have this
     *  type.
     */
    virtual cricket::MediaType media_type() const = 0;
    
    /** The mid attribute is the mid negotiated and present in the local and
     *  remote descriptions. Before negotiation is complete, the mid value may be
     *  nil. After rollbacks, the value may change from a non-nil value to nil.
     */
    virtual const absl::optional<std::string> mid() const = 0;

    /** The sender attribute exposes the RTCRtpSender corresponding to the RTP
     *  media that may be sent with the transceiver's mid. The sender is always
     *  present, regardless of the direction of media.
     */
    virtual rtc::scoped_refptr<OHOSRtpSenderInterface> sender() const = 0;

    /** The receiver attribute exposes the RTCRtpReceiver corresponding to the RTP
     *  media that may be received with the transceiver's mid. The receiver is
     *  always present, regardless of the direction of media.
     */
    virtual rtc::scoped_refptr<OHOSRtpReceiverInterface> receiver() const = 0;

    /** Direction of the RtpTransceiver */
    virtual webrtc::RtpTransceiverDirection direction() const = 0;

    /** Set Direction of the RtpTransceiver */
    virtual void SetDirection(
        webrtc::RtpTransceiverDirection new_direction) = 0;

    /** The current_direction attribute indicates the current direction negotiated for this transceiver.  */
    virtual absl::optional<webrtc::RtpTransceiverDirection> current_direction() const = 0;
   
    /** An internal slot designating for which direction the relevant PeerConnection events have been fired*/
    virtual absl::optional<webrtc::RtpTransceiverDirection> fired_direction() const = 0;

    /** The stopped attribute indicates that the sender of this transceiver will no
     * longer send, and that the receiver will no longer receive. It is true if
     * either stop has been called or if setting the local or remote description
     * has caused the RtpTransceiver to be stopped.
     */
    virtual bool Stopped() const = 0;

    /** The stopping attribute indicates that the user has indicated that the
     * sender of this transceiver will stop sending, and that the receiver will
     * no longer receive. It is always true if stopped() is true.
     * If stopping() is true and stopped() is false, it means that the
     * transceiver's stop() method has been called, but the negotiation with
     * the other end for shutting down the transceiver is not yet done. 
    */
    virtual bool Stopping() const = 0;
    
    /** Initiates a stop of the transceiver.
     * The stop is complete when stopped() returns true.
     * A stopped transceiver can be reused for a different track. 
     */
    virtual webrtc::RTCError StopStandard() = 0;

    /** Stops a transceiver immediately, without waiting for signalling.
     * This is an internal function, and is exposed for historical reasons.
     */
    virtual void StopInternal() = 0;
  
    /** The SetCodecPreferences method overrides the default codec preferences used by WebRTC for this transceiver. */
    virtual void SetCodecPreferences(rtc::ArrayView<webrtc::RtpCodecCapability> codecs) = 0;
    
    /**  Returns the set of header extensions that was set
     *with SetHeaderExtensionsToNegotiate, or a default set if it has not been called.
    */
    virtual std::vector<webrtc::RtpHeaderExtensionCapability> GetHeaderExtensionsToNegotiate() const = 0;

    /** Returns either the empty set if negotation has not yet
     * happened, or a vector of the negotiated header extensions.
     */
    virtual std::vector<webrtc::RtpHeaderExtensionCapability> GetNegotiatedHeaderExtensions() const = 0;

    /** The SetHeaderExtensionsToNegotiate method modifies the next SDP negotiation
     * so that it negotiates use of header extensions which are not kStopped.
     */
    virtual webrtc::RTCError SetHeaderExtensionsToNegotiate(
      rtc::ArrayView<const webrtc::RtpHeaderExtensionCapability> header_extensions) = 0;
  
    /** native rtp_transceiver*/
    virtual rtc::scoped_refptr<webrtc::RtpTransceiverInterface> rtp_transceiver() = 0;
    
  protected:
  virtual ~OHOSRtpTransceiverInterface() {}
};

}

#endif